<!doctype html>
<html>
<head>
  <title>Datastore and Firebase Auth Example</title>

  <!-- See https://github.com/firebase/firebaseui-web. -->
  <!-- [START gae_python37_auth_init_firebase] -->
  <!-- *******************************************************************************************
       * TODO(DEVELOPER): Paste the initialization snippet from:
       * http://console.firebase.google.com > Overview > Add Firebase to your web app.
       ***************************************************************************************** -->
  <!-- [END gae_python37_auth_init_firebase] -->
  <script>
    if (typeof firebase === 'undefined') {
      const msg = "Please paste the Firebase initialization snippet into index.html. See https://console.firebase.google.com > Overview > Add Firebase to your web app.";
      console.log(msg);
      alert(msg);
    }
  </script>
  <!-- [START gae_python37_auth_include_firebaseui] -->
  <script src="https://cdn.firebase.com/libs/firebaseui/2.6.2/firebaseui.js"></script>
  <link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/2.6.2/firebaseui.css">
  <!-- [END gae_python37_auth_include_firebaseui] -->
  <script src="{{ url_for('static', filename='script.js') }}"></script>
  <link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">

</head>
<body>

<!-- [START gae_python37_auth_firebase_html] -->
<h1>Datastore and Firebase Auth Example</h1>

<div id="firebaseui-auth-container"></div>

<button id="sign-out" hidden=true>Sign Out</button>

<div id="login-info" hidden=true>
  <h2>Login info:</h2>
  {% if user_data %}
    <dl>
      <dt>Name</dt><dd>{{ user_data['name'] }}</dd>
      <dt>Email</dt><dd>{{ user_data['email'] }}</dd>
      <dt>Last 10 visits</dt><dd>
	{% for time in times %}
          <p>{{ time['timestamp'] }}</p>
        {% endfor %} </dd>
    </dl>
  {% elif error_message %}
    <p>Error: {{ error_message }}</p>
  {% endif %}
</div>
<!-- [END gae_python37_auth_firebase_html] -->
</body>
</html>
